1. Field of the Invention
The present invention relates to an apparatus for detecting an object from an image and a method therefor, and a storage medium storing a program therefor.
2. Description of the Related Art
In recent years, a technique, described below, for detecting an object from an image captured with a camera has been discussed. First, there is a method for detecting a moving object by background subtraction. In the background subtraction, an image of a background including no subject is previously captured with a fixed camera, and a feature amount in the image is stored as a reference model. Then, a difference between the feature amount in the image input from the camera and a feature amount in the reference model is found so that an area, different from the reference model, in the input image is detected as a foreground (a moving object).
There is also a method for detecting a specific subject such as a face or a person from an image. For example, U.S. Patent Application Publication No. 2007/0237387 discusses a technique for detecting a human body. In this technique, a detection window of a predetermined size is scanned on an input image, and it is determined in two classes whether an image in the detection window is a subject.
In this determination, a large number of weak classifiers (discriminators) are effectively combined using AdaBoost to constitute a classifier, to improve determination accuracy. Such classifiers are connected in series, to constitute a cascade-type detector. The weak classifier is composed of a Histogram of Oriented Gradients (HOG) feature amount. The cascade-type detector first removes a candidate for a pattern that is not obviously a subject using the simple classifier in its front stage, and determines whether only the other candidate is a subject using the complicated classifier in its rear stage having a higher identification performance.
Japanese Patent Application Laid-Open No. 2002-74371 discusses a technique for recognizing whether a subject (a person) is detected for only an area of a moving object found by background subtraction. Generally, detection of a subject requires significantly high processing cost because a detection window is scanned in an image and a plurality of classifiers is used each time. Therefore, a subject is detected only for an area of a moving object that has been detected by background subtraction, like in the technique discussed in U.S. Patent Application Publication No. 2007/0237387, so that the whole processing cost can be reduced, compared with that when a subject is detected for the whole area in an image.
When a background starts to be photographed while a subject (a person) exists, however, an area where the person exists at the time of initialization may be stored as a background model. When the person then moves so that a true background that is hidden appears, therefore, a difference between the true background and the background model occurs. Therefore, the true background may be determined to be an area of a foreground.
Even if a search range for detection of a subject is narrowed down by background subtraction, like that in the technique discussed in U.S. Patent Application Publication No. 2007/0237387, an area of a foreground may be widened when a true background is determined to be a foreground. More specifically, the search range for the detection of the subject is not appropriately narrowed down. As a result, the subject may be unable to be detected at high speed.